# -*- coding: utf-8 -*-
import uuid

from sqlalchemy import Column, String, Boolean, ForeignKey, Float, SmallInteger, Text

from db.base import Base
from db.models.base import GUID, BaseDatabaseModel


class Attach2File(BaseDatabaseModel, Base):
    __tablename__ = "attach_2_file"

    id = Column(GUID(), primary_key=True, index=True, default=uuid.uuid1)
    file_type = Column(SmallInteger, nullable=True, comment="0: image，1: table", default=None, index=True)
    file_size = Column(Float, nullable=True, comment="文件大小")
    location = Column(String(512), nullable=True, comment="存储位置", index=True)
    origin_name = Column(String(255), nullable=True, index=True, comment="原始文件名")
    content = Column(Text, nullable=True, default=None, comment="表格内容")
    download_link = Column(String(255), nullable=True, index=True, comment="下载链接")
    is_delete = Column(Boolean, default=False, index=True)

    file_id = Column(GUID(), ForeignKey('qa_files.id'), comment="文件id")
